#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <assert.h>
#include "rngs.h"

#define DEBUG 0
#define NOISY_TEST 1



int main () {
  
  int r;  
  int k[10] = {adventurer, council_room, feast, gardens, mine,
	       remodel, smithy, village, baron, great_hall};

  struct gameState G;

  printf ("Testing isGameOver.\n");

  initializeGame(2, k, 1, &G);

  //game ends when Province stack is empty, or when 3 supply piles are empty


  //new game just was initialized, should not be over
#if (NOISY_TEST == 1)
    printf("Testing isGameOver for new gamestate.\n");
#endif
    r=isGameOver(&G);
    assert(r==0);
#if (NOISY_TEST == 1)
    printf("Test passed.\n");
#endif



#if (NOISY_TEST == 1)
    printf("Testing isGameOver for 3 empty supply stacks.\n");
#endif
    G.supplyCount[adventurer] = G.supplyCount[council_room] = G.supplyCount[feast] = 0;
    r=isGameOver(&G);
    assert(r==1);
#if (NOISY_TEST == 1)
	printf("Test passed.\n");
#endif

#if (NOISY_TEST == 1)
    printf("Testing isGameOver for empty Province stack.\n");
#endif
    initializeGame(2, k, 1, &G); //reset gamestate to fresh game so we know it's not game over due to 3 empty supply stacks
    G.supplyCount[province] = 0;
    r=isGameOver(&G);
    assert(r==1);
#if (NOISY_TEST == 1)
	printf("Test passed.\n");
#endif

    printf("isGameOver(): All tests passed!\n"); 
    
    return 0;
}

